package com.blacktea.structuralpatterns.flyweightpattern.service;

import com.blacktea.structuralpatterns.flyweightpattern.Flyweight;
import com.blacktea.structuralpatterns.flyweightpattern.FlyweightFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: black tea
 * @date: 2023/3/23 14:03
 */
@Service
@RequiredArgsConstructor
public class FlyweightService {

    private final FlyweightFactory flyweightFactory;

    public void doSomething(String intrinsicState, String extrinsicState) {
        Flyweight flyweight = flyweightFactory.getFlyweight(intrinsicState);
        flyweight.operation(extrinsicState);
    }

}
